package com.br.android.math.trigonometry.circle;

import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Point;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import android.view.Menu;
import android.view.MenuItem;

public class SettingsActivity extends PreferenceActivity {
	
//	public static String EXTRA_LAST_X = "last.x";
//	public static String EXTRA_LAST_Y = "last.y";
	public static final String PREFS_NAME = "Preferences";
	Point lastCirclePoint = new Point();
	
//	CheckBoxPreference angulos;
//	CheckBoxPreference sen;
//	CheckBoxPreference cos;
//	CheckBoxPreference tg;
	
	@Override
	@SuppressWarnings("all")
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		addPreferencesFromResource(R.xml.preferences);
		
//		if (getIntent().getExtras() != null) {
//			lastCirclePoint.x = getIntent().getExtras().getInt(EXTRA_LAST_X);
//			lastCirclePoint.y = getIntent().getExtras().getInt(EXTRA_LAST_Y);
//		}
		
//		angulos = (CheckBoxPreference)findPreference(getString(R.string.angulos));
//        sen = (CheckBoxPreference)findPreference(getString(R.string.sen));
//        cos = (CheckBoxPreference)findPreference(getString(R.string.cos));
//        tg = (CheckBoxPreference)findPreference(getString(R.string.tg));
        
        
		/** listener */
//        angulos.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
//			@Override
//			public boolean onPreferenceChange(Preference preference, Object newValue) {
//				angulos.setSummary(newValue.toString());
//				return true;
//			}
//		});
        
	}

	@Override
	public void onBackPressed() {
		// TODO verificar o pq fode na volta do settings
		Intent intent = new Intent(this, TrigonometricCircleActivity.class);
//		intent.putExtra(TrigonometricCircleActivity.EXTRA_LAST_X, lastCirclePoint.x);
//		intent.putExtra(TrigonometricCircleActivity.EXTRA_LAST_Y, lastCirclePoint.y);
		startActivity(intent);
		super.onBackPressed();
	}
	
	
	/**
	 * Inflate the menu; this adds items to the action bar if it is present.
	 */
//	@Override
//	public boolean onCreateOptionsMenu(Menu menu) {
////		getMenuInflater().inflate(R.menu.menu_settings, menu);
//		return true;
//	}
//	
//	/**
//	 * respond to menu item selection
//	 */
//	public boolean onOptionsItemSelected(MenuItem item) {
////		startActivity(new Intent(this, SettingsActivity.class));
////		return super.onOptionsItemSelected(item);
//		return true;
//	}
	
	// lendo preferences
	// SharedPreferences sharedPref =
	// PreferenceManager.getDefaultSharedPreferences(this);
	// String syncConnPref =
	// sharedPref.getString(SettingsActivity.KEY_PREF_SYNC_CONN, "");

	// @Override
	// public void onBuildHeaders(List<Header> target) {
	// loadHeadersFromResource(R.xml.preference, target);
	// }

//	@Override
//	public boolean onCreateOptionsMenu(Menu menu) {
//		menu.add(Menu.NONE, 0, 0, "Show current settings");
//		return super.onCreateOptionsMenu(menu);
//	}
//
//	@Override
//	public boolean onOptionsItemSelected(MenuItem item) {
//		switch (item.getItemId()) {
//		case 0:
//			startActivity(new Intent(this, ShowSettingsActivity.class));
//			return true;
//		}
//		return false;
//	}
}
